<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    {tpl style}
    <link rel="stylesheet" type="text/css" href="{$skin}css/js.css" />
    <link rel="stylesheet" type="text/css" href="style/global.css" />
    <script type="text/javascript" src="{$skin}js/vue.min.js"></script>
    <title>{$webname}</title>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container-fluid" style="position:relative;">
        <div class="navbar-header">
            <a href="javascript:void(0);" class="navbar-brand" onclick="history.back();"><span class="glyphicon glyphicon-chevron-left icon"></span></a>
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#list_nav">
                <span class="glyphicon glyphicon-option-horizontal"></span>
            </button>
        </div>

        <div class="collapse navbar-collapse" id="list_nav">
            <ul class="nav navbar-nav navbar-right" style="display: none">
                <li class="active"><a href="auto.shtml">自定义投注模式</a></li>
                <li><a href="../member_mybank.shtml">小金库</a></li>
                <li><a href="trend.shtml">{$game_name}走势图</a></li>
            </ul>
        </div>
        <p style="position:absolute; top:15px; left:50%; margin-left:-18px; font-size:16px;  text-shadow:2px 2px 3px #ccc;">{$game_name}</p>
    </div>

</nav>
<div id="main">
    <div class="container-fluid">
        <div class="row white_bg detailed_coin">
            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad0">
                <p>金蛋: <span class="red" id="money">0</span></p>
            </div>
            <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 pad0">
                <p>银行: <span class="red" id="bank">0</span></p>
            </div>
        </div>
    </div>
    <div class="container-fluid" style="display:none">
        <div class="row white_bg js_pad">
            <div class="btn-group text-center" style="width: 95%;">
                <a href="{:url("game/record/id/$id")}" class="btn btn-default btn_pad">我的投注</a>
                <a href="../member_relief.shtml" class="btn btn-default btn_pad">领取救济</a>
                <a href="auto.shtml" class="btn btn-default btn_pad">自动投注</a>
                <a href="rule.shtml" class="btn btn-default btn_pad">游戏规则</a>
            </div>
        </div>
    </div>
    <div class="container-fluid">
        <div class="row">
            <div class="list-group white_bg" id="list">
                <template v-for="v in list">
                    <a href="javascript:;" id="{{v.id}}" class="list-group-item">
                        <div class="container-fluid">
                            <div class="row list_pad">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-left pad0"><span>{{v.id}}</span></div>
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-left pad0"><span>{{v.kgtime}}</span></div>
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-left pad0"><span v-if="v.kj==1"><img src="{$skin}img/jg/number_{{type}}{{v.num}}.gif" alt="" class="img-responsive"></span>
                                    <template v-if="v.kj==0">
                                        <span v-if="v.stoptime>0">截止<span class="red">{{v.stoptime}}</span>秒</span>
                                        <span v-else>
                                            <span v-if="v.kjtime>0">还有<span class="red">{{v.kjtime}}</span>秒,开奖 </span>
                                                <span v-else>开奖中,请稍后!</span>
                                    </template>
                                </div>
                                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 pad0 press">
                                    <span v-if="v.status==1">已开奖</span>
                                    <span v-if="v.status==2" id="press">投注</span>
                                    <span v-if="v.status==3">开奖中</span>
                                </div>
                            </div>
                        </div>
                    </a>
                </template>

            </div>
        </div>
    </div>
<!--    <div class="container-fluid">-->
<!--        <div class="row">-->
<!--            <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">-->
<!--                <div class="panel panel-default">-->
<!--                    <div class="panel-heading" role="tab" id="headingOne">-->
<!--                        <h4 class="panel-title">-->
<!--                            <a role="button" class="center-block text-center" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">-->
<!--                                点击下注-->
<!--                            </a>-->
<!--                        </h4>-->
<!--                    </div>-->
<!--                    <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">-->
<!--                        <div class="panel-body">-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                            <button class="btn btn-default game_btn">1</button>-->
<!--                        </div>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
<!--    </div>-->
</div>
<script type="text/javascript">
    var vm = new Vue({
        el: '#list',
        data: {
            list:[],
            type:'',
            name: 'Vue.js'
        }
    });
    var timerid;
    function getContent(){
        var url="{:url("game/ajax/id/$id")}&t=" + Math.random();
        $.ajax({
            type: "GET",
            url: url,
            dataType: "json",
            timeout:3000,
            success: function(data){
                if(!data.points)data.points=0;
                if(!data.bank)data.bank=0;
                $("#money").text(data.points);
                $("#bank").text(data.bank);
                vm.$data.list=data.list;
                vm.$data.type=data.type;
                timerid=setInterval(djs,1000);
            },
            error:function(){
                getContent();
            }
        })
    }
    function djs() {
        for(var i in vm.$data.list){
            --vm.$data.list[i].stoptime;
            --vm.$data.list[i].kjtime;
            if(vm.$data.list[i].kj==0 && vm.$data.list[i].kjtime<1){
                console.info('<<'+vm.$data.list[i].kjtime);
                clearInterval(timerid);
                getContent();
                break;
            }
        }
    }
    $(document).ready(function(){
        clearInterval(timerid);
        getContent();
    });
    $(function () {
        $("#list").on('click','.press',function () {
            no=$(this).parents("a").attr("id");
            location.href="{:url("game/press/id/$id")}&no="+no;
            return false;
        });
        $("#list").on("click",".text-left",function () {
            no=$(this).attr("id");
            //location.href="{:url("game/item/id/$id")}&no="+no;
            location.href="{:url("game/record/id/$id")}";
        })

    })
</script>
{tpl foot}
</body>
</html>

